#ifndef CANDIDATEEXTRACTOR_H
#define CANDIDATEEXTRACTOR_H
#include <vector>
#include <list>
#include "../include/objectPoint.h"
#include "../include/LSfeatureObject.h"
#include "cmath"
#include "iostream"

using namespace std;

class Candidate
{
public:
    Candidate();
    LSfeatureObject object1_;
    int appearanceCount;
    Candidate(LSfeatureObject obj1)
           :object1_(obj1)
       {
       appearanceCount = 0;
       MATCH = false;
       }
       bool matchCandidates(Candidate c)//condition can better
       {
           double dist = this->object1_.getMiddlePoint().getDistanceFromPoint(c.object1_.getMiddlePoint());

           double r = this->object1_.getMiddlePoint().getR();
           double rc = c.object1_.getMiddlePoint().getR();
           //cout<<"\n r1 "<< this->object1_.getMiddlePoint().getR()<<" r2 "<< c.object1_.getMiddlePoint().getR()<<" dist : "<<dist<< " R : "<<fabs(r-rc);
           if( fabs(r-rc) > 20 )
           {
               return false;
           }
        //   cout<<" match";
           return true;

       }
       bool IsMatch()  {return MATCH; }
       void SetMatch(bool flag){MATCH = flag;}
       void updateCandidate(Candidate c)
       {
           object1_ = c.object1_;
       }

   private:
       bool MATCH;

};

class CandidateExtractor
{
public:
    CandidateExtractor();
    void setObjects(vector<LSfeatureObject> objts);
    vector <Candidate> doExtractor(double MaxLength , double minLength);
    vector <Candidate*> getCandidates();
private:
    vector<LSfeatureObject> objects;
};

#endif // CANDIDATEEXTRACTOR_H

